import java.util.Scanner;

public class Card {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num1 = 2021;
        int num = 0;
        while (num1 > 0) {
            num ++;
            String str = Integer.toString(num);
            for (int i = 0; i < str.length(); i++) {
                if (str.charAt(i) == '1') {
                    num1 --;
                }
            }
        }
        System.out.println(num);
    }
}
